<%@page import="java.text.NumberFormat"%>
<%@page import="java.util.ArrayList"%>
<%@page import="model.Domain"%>
<%@page import="javax.cache.CacheException"%>
<%@page import="java.util.Collections"%>
<%@page import="javax.cache.CacheManager"%>
<%@page import="javax.cache.Cache"%>
<%
NumberFormat format = NumberFormat.getInstance();
Cache cache=null;
try {
    cache = CacheManager.getInstance().getCacheFactory().createCache(Collections.emptyMap());
} catch (CacheException e) {
   e.printStackTrace();
   
}
ArrayList<Domain> listDomain = null;
if(cache.containsKey("lastupdates"))
{
	listDomain = (ArrayList<Domain>) cache.get("lastupdates");
}
%>
<%
if(listDomain != null)
{
%>
<table cellspacing="0" cellpadding="0" class="tb">
	<tbody>
		<tr>
			<th colspan="4">Recent site update</th>
		</tr>
		<tr>
			<th class="tl">Domain</th>
			<th>Speed site</th>
			<th>Google pagerank</th>
			<th>Alexa rank</th>
		</tr>
		<%
		for(int i=0;i<listDomain.size();i++)
		{
		%>
			<tr>
				<td class="tl"><a href="/site/<%=listDomain.get(i).getName() %>" title="<%=listDomain.get(i).getName() %>"><%=listDomain.get(i).getName() %></a></td>
				<td><%=(listDomain.get(i).getSpeedSite() != null&&!listDomain.get(i).getSpeedSite().getValue().equals("null"))?"<b>"+listDomain.get(i).getSpeedSite().getValue()+"</b> Seconds":"-" %></td>
				<td><%=(listDomain.get(i).getGoogle() != null&&!listDomain.get(i).getGoogle().getValue().equals("null"))?listDomain.get(i).getGoogle().getValue():"0" %></td>
				<td><%=(listDomain.get(i).getAlexa() != 0)?format.getInstance().format(listDomain.get(i).getAlexa()):"-" %></td>
			</tr>
		<%
		}
		%>
	</tbody>
</table>
<%
}
%>